How to use the Debugging Modern Memory Manager for Power Macintosh
02/02/95
• Brief Overview
The Debugging Modern Memory Manager (aka DMMM) is a debugging version of the Modern Memory Manager. Once DMMM loads all memory manager heaps created will have robust checking capability.
Installing DMMM onto your machine will allow you to catch many of the popular memory manager programming errors. Code using disposed blocks will encounter problems because blocks are filled with garbage after a DisposePtr or DisposeHandle call. Writing over the end of blocks will result in heap check routines failing. Passing fake or bogus handles to the Memory Manager will result in errors being reported via the DebugStr mechanism.
• How it can be configured
The “Debug Memory Mgr” control panel allows users to set the level of validation required. Set Debugging to the off position and no more errors will be reported, turn it on then the default validation checking errors will be reported along with any of the options you have chosen. There are four different options that can be set by the developer:
1. Check Heap On Entry - Before doing an operation, all memory blocks, headers, and trailers are validated to ensure that nothing has been over written. This is useful to find if anything you are doing between memory manager calls could possibly be corrupting memory manager data structures Since a complete heap check is done for every call to the Memory Manager, this will definitely slow your machine to a crawl.
2. Check Heap on Exit - This routine does the same checking as “Check Heap On Entry” but does it after the call has been completed. This is useful for detecting subtle bugs GrowZone and PurgeProc routines in your application.
3. Fill Free Blocks - Whenever a block is disposed, emptied or purged the memory it occupied is filled with a garbage pattern. This quickly helps determine when your program uses data in disposed blocks. Unlike heap checking, this has very little impact on performance.
4. Check Blocks - When the memory manager is passed a handle or a pointer, a basic validity check is made to make sure that the address is valid. This option tells the memory manager to perform even more robust validation of the passed in pointer or handle.
• Machines and Systems it will work with
The DMMM will work with all currently shipping Power Macintosh machines, running 7.1.2 or later. And of course the DMMM only runs when you have the Modern Memory Manager turned on in the Memory control panel. If you install a system update over top of the DMMM, then you will need to reinstall the DMMM.
• Known Gotchas
Currently there are no known problems with the DMMM itself, but there are two components of System 7.5 that do not work well with the DMMM:
> During startup, while PCExchange is loading the DMMM will report that a fake handle is being passed to RecoverHandle. Just hit go to get past this hiccup.
> When using the Chooser, the DMMM will report many times that bogus handles are being passed. If you plan to use the Chooser, it might be a wise idea to temporarily turn off debugging until you are finished.
• Additional Issues
> Once installed, there is no way to remove the DMMM. It installs a control panel, and extension, and various resources into your system folder. If the extension is removed your machine will appear to hang the next time you restart. The machine is not hung but has booted in full memory manager checking mode. The Finder will eventually finsh booting, but it may take a couple of minutes.
> Unfortunately the System heap cannot have the robust checking that other heaps are capable of having. However, all the block validity checks can still be performed on this heap.
• Reporting problems
If you find any bugs with DMMM,have any problems, comments, or suggestions please mail DMMM@powertalk.apple.com with you inquiries. Suggestions on improvements are always welcome.
• Revision History
1.0 - Initial Version
1.0.1 - Added the ability to remove the debugging memory manager and install a non-debug version